home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 21 / Cream of the Crop 21 (Terry Blount) (October 1996).iso / os2 / e33el2.zip / emacs / 19.33 / lisp / ediff-wind.el < prev    next >
Lisp/Scheme  |  1996-07-02  |  45KB  |  1,208 lines

  1. ;;; ediff-wind.el --- window manipulation utilities
  2.  
  3. ;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
  4.  
  5. ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
  6.  
  7. ;; This file is part of GNU Emacs.
  8.  
  9. ;; GNU Emacs is free software; you can redistribute it and/or modify
  10. ;; it under the terms of the GNU General Public License as published by
  11. ;; the Free Software Foundation; either version 2, or (at your option)
  12. ;; any later version.
  13.  
  14. ;; GNU Emacs is distributed in the hope that it will be useful,
  15. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17. ;; GNU General Public License for more details.
  18.  
  19. ;; You should have received a copy of the GNU General Public License
  20. ;; along with GNU Emacs; see the file COPYING.  If not, write to the
  21. ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  22. ;; Boston, MA 02111-1307, USA.
  23.  
  24. ;;; Code:
  25.  
  26. (require 'ediff-init)
  27.  
  28. ;; Compiler pacifier
  29. (defvar icon-title-format)
  30. (defvar top-toolbar-height)
  31. (defvar bottom-toolbar-height)
  32. (defvar left-toolbar-height)
  33. (defvar right-toolbar-height)
  34. (defvar left-toolbar-width)
  35. (defvar right-toolbar-width)
  36. (defvar default-menubar)
  37. (defvar frame-icon-title-format)
  38. ;; end pacifier
  39.  
  40.  
  41. (defvar ediff-window-setup-function (if (ediff-window-display-p)
  42.                     'ediff-setup-windows-multiframe
  43.                       'ediff-setup-windows-plain)
  44.   "*Function called to set up windows.
  45. Ediff provides a choice of two functions: ediff-setup-windows-plain, for
  46. doing everything in one frame, and ediff-setup-windows-multiframe,
  47. which sets the control panel in a separate frame. Also, if the latter
  48. function detects that one of the buffers A/B is seen in some other frame,
  49. it will try to keep that buffer in that frame.
  50.  
  51. If you don't like the two functions provided---write your own one.
  52. The basic guidelines:
  53.     1. It should leave the control buffer current and the control window
  54.        selected. 
  55.     2. It should set ediff-window-A, ediff-window-B, ediff-window-C,
  56.        and ediff-control-window to contain window objects that display
  57.        the corresponding buffers.
  58.     3. It should accept the following arguments:
  59.        buffer-A, buffer-B, buffer-C, control-buffer
  60.        Buffer C may not be used in jobs that compare only two buffers.
  61. If you plan to do something fancy, take a close look at how the two
  62. provided functions are written.")
  63.  
  64. ;; indicates if we are in a multiframe setup
  65. (ediff-defvar-local ediff-multiframe nil "")
  66.  
  67. ;; Share of the frame occupied by the merge window (buffer C)
  68. (ediff-defvar-local ediff-merge-window-share 0.45 "")
  69.  
  70. ;; The control window.
  71. (ediff-defvar-local ediff-control-window nil "")
  72. ;; Official window for buffer A
  73. (ediff-defvar-local ediff-window-A nil "")
  74. ;; Official window for buffer B
  75. (ediff-defvar-local ediff-window-B nil "")
  76. ;; Official window for buffer C
  77. (ediff-defvar-local ediff-window-C nil "")
  78. ;; Ediff's window configuration.
  79. ;; Used to minimize the need to rearrange windows.
  80. (ediff-defvar-local ediff-window-config-saved "" "")
  81.  
  82.  
  83. (defvar ediff-split-window-function 'split-window-vertically
  84.   "*The function used to split the main window between buffer-A and buffer-B.
  85. You can set it to a horizontal split instead of the default vertical split
  86. by setting this variable to `split-window-horizontally'.
  87. You can also have your own function to do fancy splits.
  88. This variable has no effect when buffer-A/B are shown in different frames.
  89. In this case, Ediff will use those frames to display these buffers.")
  90.  
  91. (defvar ediff-merge-split-window-function 'split-window-horizontally
  92.   "*The function used to split the main window between buffer-A and buffer-B.
  93. You can set it to a vertical split instead of the default horizontal split
  94. by setting this variable to `split-window-vertically'.
  95. You can also have your own function to do fancy splits.
  96. This variable has no effect when buffer-A/B/C are shown in different frames.
  97. In this case, Ediff will use those frames to display these buffers.")
  98.  
  99. (defconst ediff-control-frame-parameters
  100.   (list 
  101.    '(name . "Ediff")
  102.    ;;'(unsplittable . t)
  103.    '(minibuffer . nil)
  104.    '(user-position . t)          ; Emacs only
  105.    '(vertical-scroll-bars . nil)  ; Emacs only
  106.    '(scrollbar-width . 0)         ; XEmacs only
  107.    '(menu-bar-lines . 0)          ; Emacs only
  108.    ;; don't lower and auto-raise
  109.    '(auto-lower . nil)
  110.    '(auto-raise . t)
  111.    ;; this blocks queries from  window manager as to where to put
  112.    ;; ediff's control frame. we put the frame outside the display,
  113.    ;; so the initial frame won't jump all over the screen
  114.    (cons 'top  (if (fboundp 'ediff-display-pixel-height)
  115.            (1+ (ediff-display-pixel-height))
  116.          3000))
  117.    (cons 'left (if (fboundp 'ediff-display-pixel-width)
  118.            (1+ (ediff-display-pixel-width))
  119.          3000))
  120.    )
  121.   "Frame parameters for displaying Ediff Control Panel.
  122. Do not specify width and height here. These are computed automatically.")
  123.  
  124. ;; position of the mouse; used to decide whether to warp the mouse into ctl
  125. ;; frame
  126. (ediff-defvar-local ediff-mouse-pixel-position nil "")
  127.  
  128. ;; not used for now
  129. (defvar ediff-mouse-pixel-threshold 30
  130.   "If the user moves mouse more than this many pixels, Ediff won't warp mouse into control window.")
  131.  
  132. (defvar ediff-grab-mouse t
  133.   "*If t, Ediff will always grab the mouse and put it in the control frame.
  134. If 'maybe, Ediff will do it sometimes, but not after operations that require
  135. relatively long time. If nil, the mouse will be entirely user's
  136. responsibility.")
  137.  
  138. (defvar ediff-control-frame-position-function 'ediff-make-frame-position
  139.   "Function to call to determine the desired location for the control panel.
  140. Expects three parameters: the control buffer, the desired width and height
  141. of the control frame. It returns an association list
  142. of the form \(\(top . <position>\) \(left . <position>\)\)")
  143.  
  144. (defvar ediff-control-frame-upward-shift (if ediff-xemacs-p 42 14)
  145.   "*The upward shift of control frame from the top of buffer A's frame.
  146. Measured in pixels.
  147. This is used by the default control frame positioning function,
  148. `ediff-make-frame-position'. This variable is provided for easy
  149. customization of the default.")
  150.  
  151. (defvar ediff-narrow-control-frame-leftward-shift (if ediff-xemacs-p 7 3)
  152.   "*The leftward shift of control frame from the right edge of buf A's frame.
  153. Measured in characters.
  154. This is used by the default control frame positioning function,
  155. `ediff-make-frame-position' to adjust the position of the control frame
  156. when it shows the short menu. This variable is provided for easy
  157. customization of the default.")
  158.  
  159. (defvar ediff-wide-control-frame-rightward-shift 7
  160.   "*The rightward shift of control frame from the left edge of buf A's frame.
  161. Measured in characters.
  162. This is used by the default control frame positioning function,
  163. `ediff-make-frame-position' to adjust the position of the control frame
  164. when it shows the full menu. This variable is provided for easy
  165. customization of the default.")
  166.  
  167.  
  168. ;; Wide frame display
  169.  
  170. ;; t means Ediff is using wide display
  171. (ediff-defvar-local ediff-wide-display-p nil "")
  172. ;; keeps frame config for toggling wide display
  173. (ediff-defvar-local ediff-wide-display-orig-parameters nil 
  174.   "Frame parameters to be restored when the user wants to toggle the wide
  175. display off.")
  176. (ediff-defvar-local ediff-wide-display-frame nil
  177.   "Frame to be used for wide display.")
  178. (ediff-defvar-local ediff-make-wide-display-function 'ediff-make-wide-display
  179.   "The value is a function that is called to create a wide display.
  180. The function is called without arguments. It should resize the frame in
  181. which buffers A, B, and C are to be displayed, and it should save the old
  182. frame parameters in `ediff-wide-display-orig-parameters'.
  183. The variable `ediff-wide-display-frame' should be set to contain
  184. the frame used for the wide display.")
  185.  
  186. ;; Frame used for the control panel in a windowing system.
  187. (ediff-defvar-local ediff-control-frame nil "")
  188.  
  189. (defvar ediff-prefer-iconified-control-frame nil
  190.   "*If t, keep control panel iconified when help message is off.
  191. T